/*==========================================================
 *
 * @author	Limpo, limpo_soft@qq.com
 * @date	10/30/11 10:47:10 CST
 * @brief	
 *
 *  Copyright (c) 2011, Limpo
 *========================================================== 
 */

#include "ctime.h"
#include <time.h>

namespace Oxygen
{
	uint64 Time::Second()
	{
		return time( NULL );
	}

	Time::operator uint64()
	{
		return Second();
	}

	const char* Time::Format( const char* fmt )
	{
		static char buff[32] = {'\0'};
		bzero( buff, sizeof( buff ) );
		
		time_t raw;
		struct tm *timeinfo;

		time( &raw );
		timeinfo = localtime( &raw );

		strftime( buff, sizeof( buff ), fmt, timeinfo );

		return buff;
	}

}; // end of Oxygen
